package org.dataone.dataUsage;

import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/search.htm")
public class SearchController {

	static Logger log = Logger.getLogger("SearchController");
	@RequestMapping(method=RequestMethod.POST)
	public @ResponseBody String handleRequestInternal(HttpServletRequest arg0,
			HttpServletResponse arg1) throws Exception {
		String identifier = arg0.getParameter("identifier");
		log.info(identifier);
		Map<String, Object> model = new HashMap<String, Object>();
		model.put("result", identifier);
		return "dataone_search";
	}
}

	
	/*protected ModelAndView handleRequestInternal(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		// TODO Auto-generated method stub
		String identifier = request.getParameter("identifier");
		System.out.print(identifier);
		/*Map<String, Object> model = new HashMap<String, Object>();
		String result = getEntity(identifier);
		model.put("result", result);
		return new ModelAndView("result.jsp");
	}*/
	/*public String getEntity(String id) throws InvalidToken, InvalidRequest,
			ServiceFailure, NotAuthorized, NotImplemented,
			InsufficientResources {
		SearchEntity Entity = new SearchEntity();
		CNode c = Entity.getCnode();
		MNode m = Entity.getMnode();
		return c.getLogRecords().toString();
	}*/

